import service from '@/api/request/request'

export function getDatasetList () {
  return service({
    url: '/dataset/list',
    method: 'get'
  })
}

export function getDatasetListGrant () {
  return service({
    url: '/dataset/list/grant',
    method: 'get'
  })
}

export function getDatasetListPublic () {
  return service({
    url: '/dataset/public/list',
    method: 'get'
  })
}

export function getDatasetListAvailable () {
  return service({
    url: '/dataset/available/list',
    method: 'get'
  })
}

export function getDataset (id) {
  return service({
    url: '/dataset/get',
    method: 'get',
    params: {
      dataset_id: id
    }
  })
}

export function editDataset (data) {
  return service({
    url: '/dataset/edit',
    method: 'post',
    data
  })
}

export function deleteDataset (data) {
  return service({
    url: '/dataset/delete',
    method: 'post',
    data
  })
}

export function grantDataset (data) {
  return service({
    url: '/dataset/grant',
    method: 'post',
    data
  })
}

export function getDatasetMemberList (params) {
  return service({
    url: '/dataset/grant/user/list',
    method: 'get',
    params
  })
}

export function deleteDatasetGrant (data) {
  return service({
    url: '/dataset/grant/delete',
    method: 'post',
    data
  })
}

export function changeDatasetPublic (data) {
  return service({
    url: '/dataset/public/edit',
    method: 'post',
    data
  })
}

export function createDataset (data) {
  return service({
    url: '/dataset/create',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data
  })
}

export function createDatasetByFile (data) {
  return service({
    url: '/dataset/create/file',
    method: 'post',
    data
  })
}
